<?php
namespace Admin\Controller;
use Think\Controller;

class SysController extends CommonController{

		// public function index(){
		
		// $this->display();
		// }
	

	//系统共同配置项，未写入数据库
	public function lists(){

			if(IS_POST){
				//var_dump($_POST);
			$file='./App/Common/Conf/config.php';
            $config=array_merge(include $file,array_change_key_case($_POST,CASE_UPPER));
            //var_dump($config);换行\r\n  字符转为字符串var_export
            $str="<?php\r\nreturn ".var_export($config,true)."; ?>";
            if(file_put_contents($file, $str)){
                $this->success('修改配置成功',U('lists'));
            }else{
                $this->error('修改配置失败');
            }
            return;
        }
		$this->display();

	}

	public function add(){
		
		$this->display();
		}

	    public function jifen(){
    	if(IS_POST){
            $file="./App/Common/Conf/config.php"; //全局配置
            $config=array_merge(include $file,array_change_key_case($_POST,CASE_UPPER));
            $str="<?php\r\n return ".var_export($config,true)."; ?>";
            if(file_put_contents($file, $str)){
                $this->success('修改积分配置成功！',U('Sys/jifen'));
            }else{
                $this->error('修改积分配置失败！');
            }
            return;
        }
    	$this->display();
    }

	
}
	